package com.spzx.JUC2.test7;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;

public class ExecutorsDemo04 {

    public static void main(String[] args) {
        ExecutorService executorService = Executors.newSingleThreadExecutor();

        ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor();

        for (int i = 0; i < 10; i++) {
            executorService.submit(()->{
                System.out.println(Thread.currentThread().getName() + "mission success");
            });
        }

        for (int i = 0; i < 10; i++) {
            scheduledExecutorService.submit(()->{
                System.out.println(Thread.currentThread().getName() + "mission success");
            });
        }

        executorService.shutdown();
        scheduledExecutorService.shutdown();
    }
}
